package com.room.service;

import com.room.mapper.CollegeMapper;
import com.room.pojo.College;
import com.room.pojo.Student;
import com.room.pojo.vo.CollegeVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @创建人 lin
 * @创建时间 2019/10/6
 * @描述
 */
@Service
public class CollegeService {
    @Autowired
    CollegeMapper collegeMapper;

    //删除学生数据
    //根据传进的id删除学生数据
    public boolean deleteColById(String ids){
        String[] split = ids.split(",");
        return collegeMapper.deleteColById(split) == split.length;
    }

    public List<College> getAllCollege(){
        return collegeMapper.getAllCollege();
    }

    //根据分页获取学生数据
    public List<College> getCollegeByPage(Integer page, Integer size){
        int start  = (page-1)* size;
        return collegeMapper.getCollegeByPage(start, size);
    }

    //获取总数
   public Long getCollegeCount(){
        return collegeMapper.getCollegeCount();
   };

    //导出数据
    public List<CollegeVO> getCollegeVO(){
        return collegeMapper.getAllCollegeVO();
    }
//获取学院最大编号
  public String getMaxId(){
        return collegeMapper.getMaxId();
  }

  public int insertCollege(College college){
        return collegeMapper.insert(college);
  }
}
